import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sainbainu/common/models/response/follow_fans_response.dart';
import 'package:sainbainu/common/widgets/widget.dart';

import '../index.dart';

/// hello
class UserWidget extends GetView<HomeFollowController> {
  final VoidCallback? onTap;
  final FollowFansItem item;

  const UserWidget({
    Key? key,
    this.onTap,
    required this.item,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: _buildCoverArea(),
    );
  }

  /// 头部区域
  Widget _buildCoverArea() {
    return Container(
      width: 65,
      height: 65,
      decoration: BoxDecoration(
        border: Border.all(color: Colors.white, width: 3),
        borderRadius: BorderRadius.circular(65),
      ),
      child: _buildCoverImage(),
    );
  }

  /// 封面图片
  Widget _buildCoverImage() {
    return ClipRRect(
        borderRadius: BorderRadius.circular(65),
        child: CustomImage(url: item.creatorAvatar ?? ''));
  }
}
